﻿@model trangbaocao.Models.Device_StationsModel
<div class="container_12">       
    <div class="grid_12">            
        <div class="module">
                <h2 align="right"><span align="right"><a href="@Url.Action("Index", "Move_Device")">Quay lại</a></span></h2>                        
                <div class="module-body">
                @using (Html.BeginForm("Dieuchuyen_Device", "Move_Device", FormMethod.Post, new { id = "Dieuchuyen_Device" }))
                {                      
                    <div align="center" style="margin-bottom:10px;">
                        <h3>ĐIỀU CHUYỂN THIẾT BỊ </h3>
                        <div class="img-device-station-edit" align="center">
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/1341001570_wire_transfer.png")" width="12%" /> 
                        </div>
                    </div>
                    if (TempData["msg"] != null)
                    {                            
                        <span class="notification n-error">@TempData["msg"]</span>
                    } 
         <table>
            <div style="width:50%; text-align:center; float:left; padding-top:0px">
                    <p align="center">
                        <label style="width:60%; text-align:right;">Mã hệ thống hiện tại:</label>
                        <div class="ma_he_thong" align="right" style="padding-left: 0px; width: 100%">
                            @Html.TextBoxFor(model => model.ma_he_thong, new { @name = "ma_he_thong_old", @class = "input-medium", @disabled = "disabled" })  
@*                            <b>@Html.DisplayFor(model => model.ma_he_thong)</b>
*@                        </div>                                            
                    </p> 
                    
                    <p align="center">
                        <label style="width:30%; text-align:right; margin-top:5px">Tên thiết bị:</label>
                        <div class="thietbi" align="right" style="margin-top:5px; width: 100%">
                            @Html.TextBoxFor(model => model.name, new { @name = "name_old", @class = "input-medium", @disabled = "disabled" }) 
@*                            <b>@Html.DisplayFor(model => model.name)</b>
*@                            @*<font color="red">(*)</font>*@
                        </div>                                            
                    </p>
                    
                    <p align="center">
                        <label style="width:26%; text-align:right; margin-top:5px">Trung tâm:</label>
                        <div align="right" style="margin-top:5px">
                        @if (Model.trungtam_id != null)
                        { @Html.DropDownListFor(x => x.main_stations_id, Model.trungtam_id, new { @name = "main_stations_id_old", @id = "main_stations_id_old", @disabled = "disabled" })                     
                                                 
                        }
                        </div>
@*                        <div align="right" style="margin-top:10px">
                        <b>@Html.DisplayFor(x => x.main_stations_id, Model.trungtam_id)</b>
                         </div>
*@                    </p>
                     
                    <p align="center" style="padding-left:11px; width:100%">
                        <label style="width:13%; text-align:left; margin-top:5px">Trạm:</label>
@*                            <div align="right" style="margin-top:10px">
                             <b>@Html.DisplayFor(x => x.stations_id, Model.tram_id)</b>                               
                            </div>
*@                          <div align="right" style="margin-top:5px"> 
                            @if (Model.tram_id != null)
                             {   
                                 @Html.DropDownListFor(x => x.stations_id, Model.tram_id, new { @name = "stations_id_old", @id = "stations_id_old", @disabled = "disabled" })
                             } 
                             </div>   
                             @*<font color="red">(*)</font>*@                             
                        <label style="width:55%; text-align:left;">
                            @Html.ValidationMessageFor(model => model.stations_id)
                        </label>                    
                    </p>
                    
                    @Html.HiddenFor(x => x.device_id)
                    <div align="center">
                        <label style="width:36%; text-align:right;">Ngày lắp đặt:</label>
                            <p align="center" style="width:55%; text-align:right; margin-right:35px">
                                @Html.TextBoxFor(model => model.ngay_lap_dat, new { @name = "ngay_lap_dat", @class = "date" })
                            </p>                        
                    </div>
                    <div align="center">
                        <label style="width:40%; text-align:right;">Ngày sử dụng:</label>
                            <p align="center" style="width:55%; text-align:right; margin-right:35px">
                                @Html.TextBoxFor(model => model.ngay_su_dung, new { @name = "ngay_su_dung", @class = "date" }) 
                            </p>                       
                    </div>
                    </div>
                    <div style="width:50%; text-align:center; float:left; margin-bottom:5px">
                    <p align="center">
                        <label style="width:55%; text-align:left;">Mã hệ thống hiện mới:</label>
                        <div class="ma_he_thong" align="center" style="padding-left: 0px; width: 100%">
                            @Html.TextBoxFor(model => model.ma_he_thong, new { @name = "ma_he_thong", @class = "input-medium" })  
                        </div>                                            
                    </p>   
                    <p align="center">
                        <label style="width:55%; text-align:left;">Tên thiết bị mới:</label>
                        <div class="thietbi" align="center" style="padding-left: 10px; width: 100%">
                            @Html.TextBoxFor(model => model.name, new { @name = "name", @class = "input-medium" }) 
                            <font color="red">(*)</font>
                        </div>                                            
                    </p>
                    <p align="center">
                        <label style="width:55%; text-align:left;">Trung tâm mới:</label>
                        @if (Model.trungtam_id != null)
                        { 
                            @Html.DropDownListFor(x => x.main_stations_id, Model.trungtam_id)                     
                        }
                    </p>
                    <p align="center" style="padding-left:11px; width:100%">
                        <label style="width:60.8%; text-align:left;">Trạm mới:</label>
                             @if (Model.tram_id != null)
                             {                                  
                                 @Html.DropDownListFor(x => x.stations_id, Model.tram_id)
                             }    
                             <font color="red">(*)</font>                             
                        <label style="width:55%; text-align:left;">
                            @Html.ValidationMessageFor(model => model.stations_id)
                        </label>                    
                    </p>
                    <p align="center">
                       <label style="width:55%; text-align:left;">Trạng thái hoạt động:</label>
                        <select name="trang_thai_hd">
                            <option value="1"  @(Model.trang_thai_hd == 1 ? "selected" : "")>Bình thường</option>
                            <option value="0" @(Model.trang_thai_hd == 0 ? "selected" : "")>Ngừng</option>
                        </select>                        
                    </p>
                    <p align="center">
                        <label style="width:55%; text-align:left;">Nhân viên lắp đặt:</label>
                        @Html.TextBoxFor(model => model.nv_lap_dat, new { @name = "nv_lap_dat", @class = "input-medium" })
                       </p> 
                    <p align="center">
                        <label style="width:55%; text-align:left;">Ghi chú:</label>
                        @Html.TextBoxFor(model => model.ghi_chu, new { @name = "ghi_chu", @class = "input-medium" })
                        
                    </p>
                    </div>
      </table>                    
                    <div class="button" align="center">
                        <p align="center" style="width:26%; text-align:center;">
                            <input class="submit-green" type="submit" value="Cập nhật" /> 
                            <input class="submit-gray" type="reset" value="Hủy" />
                            @*<input class="submit-gray" type="button"  onclick="location.href='@Url.Action("Index", "User")'" value="Quay lại" />*@
                        </p>
                    </div>  
                }
                </div> <!-- End .module-body -->
        </div>  <!-- End .module -->
        <div style="clear:both;"></div>
    </div> <!-- End .grid_12 --> 
    <div style="clear:both;"></div>
</div> <!-- End .container_12 -->

<script type="text/javascript">
    $(document).ready(function () {
        $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
    });
</script>
<script type="text/javascript">
    $("#main_stations_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getStationsJson", "Move_Device")',
            data: { MainStationId: $("#main_stations_id > option:selected").attr("value"), Order: "name" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn nhà trạm---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#stations_id").html(items.join(' '));
            }
        })
    });
</script>

